<script lang="ts" setup>
import axios from 'axios';
import { ref,onMounted } from 'vue';
import { useRoute } from 'vue-router';
import { useRouter } from 'vue-router';

let router=useRouter()
let form=ref({
  username:"",
  password:""
})

function onEdit() {
  axios.put("http://localhost:8080/api/edit",form.value).then(()=>{
    router.push({
      path: '/'
    })

  })

}
</script>

<template>
  <h1>注册</h1>
  <el-form :model="form" label-width="auto" style="max-width: 600px">
    <el-form-item label="用户名">
      <el-input v-model="form.username" />
    </el-form-item>
    <el-form-item label="密码">
      <el-input v-model="form.password" />
    </el-form-item>
    <el-form-item>
      <el-button type="primary" @click="onEdit">注册</el-button>
    </el-form-item>
  </el-form>
</template>

<style scoped>

</style>